package game.players.goalkeeper;

import java.awt.Point;

import com.uqbar.vainilla.DeltaState;
import com.uqbar.vainilla.appearances.Sprite;

import game.players.SoccerPlayer;
import game.soccerField.Arc;

public abstract class Goalkeeper  extends SoccerPlayer{
	
	private Arc arc;
	private Point properLocation = new Point();
	private Sprite stationarySprite;

	public Goalkeeper(int x, int y) {
		super(x, y);
	}
	
	@Override
	public boolean isGoalKeeper() {
		return true;
	}
	
	@Override
	public void update(DeltaState deltaState) {
		this.updateProperLocation();
		super.update(deltaState);
	}
	@Override
	public void loseTheBall() {
		// el arquero no puede perder la pelota
	}
	
	public abstract void updateProperLocation();
	
	public abstract void takeTheBall();
	
	public boolean isMisplaced() {		
		return Point.distance(this.getX(),this.getY(),
				this.properLocation.getX(),this.properLocation.getY()) > 300;
	}	
	
	public boolean isAccommodated(){
		return Point.distance(this.getX(),this.getY(),
				this.getProperLocation().getX(),this.getProperLocation().getY())
				< 100;
	}
	
	@Override
	public void throwOutTheBall() {
		//no hace nada		
	}

	public Arc getArc() {
		return arc;
	}

	public void setArc(Arc arc) {
		this.arc = arc;
	}

	public Point getProperLocation() {
		return properLocation;
	}

	public void setProperLocation(Point properLocation) {
		this.properLocation = properLocation;
	}

	public Sprite getStationarySprite() {
		return stationarySprite;
	}

	public void setStationarySprite(Sprite stationarySprite) {
		this.stationarySprite = stationarySprite;
	}
	
	
}
